home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Development Platforms / Apple II / Apple II Sample Code / MPW IIGS SC / SC.002.BusyBox / busybox.p / umenu.p < prev    next >
Encoding:
Text File  |  1990-06-19  |  2.6 KB  |  119 lines  |  [TEXT/MPS ]

  1. {**********************************************************************
  2. {*
  3. {* BusyBox uMenu -- Version 3.0  (interface)
  4. {*
  5. {* Copyright (c)
  6. {* Apple Computer, Inc.  1986-1989
  7. {* All Rights Reserved.
  8. {*
  9. {* This file contains the interface to the code which implements 
  10. {* menus in the busybox program.
  11. {*
  12. {**********************************************************************}
  13.  
  14. UNIT uMenu;
  15.  
  16. INTERFACE
  17.  
  18. USES
  19.        types,
  20.        locator,
  21.        quickdraw,
  22.        fonts,
  23.        INTMATH,
  24.        events,
  25.        memory,
  26.        controls,
  27.        gsos,
  28.        windows,
  29.        lineedit,
  30.        dialogs,
  31.        menus,
  32.        desk,
  33.        STDFILE,
  34.        resources,
  35.     
  36.        uGlobals,
  37.        uUtils,
  38.        uWindow;
  39.  
  40.  
  41. procedure DoMenu;      {Execute a menu item}
  42. procedure SetUpMenus;  {Install menus and redraw menu bar}
  43.  
  44.  
  45. IMPLEMENTATION
  46.  
  47. {$R-}
  48.  
  49. procedure DoQuitItem;
  50.  
  51.    {Private routine to set Done flag if the "Quit" item was selected}
  52.  
  53.    begin   {of DoQuitItem}
  54.        Done := true;
  55.    end;    {of DoQuitItem}
  56.  
  57.  
  58.  
  59. procedure DoAboutItem;
  60.     var
  61.         ignore : integer;
  62.    begin   {of DoAboutItem}
  63.         ignore := AlertWindow(4,NIL,Ptr(1));
  64.    end;    {of DoAboutItem}
  65.  
  66.  
  67. procedure DoMenu;
  68.  
  69.    {Procedure to handle all menu selections.  Examines the Event.TaskData
  70.     menu item ID word from TaskMaster (from Event Manager) and calls the
  71.     appropriate routine.  While the routine is running the menu title is
  72.     still highlighted.  After the routine returns, we unhilight the
  73.     menu title.}
  74.  
  75.    var menuNum : integer;
  76.        itemNum : integer;
  77.  
  78.    begin   {of DoMenu}
  79.  
  80.        menuNum := HiWord (Event.wmTaskData);
  81.        itemNum := LoWord (Event.wmTaskData);
  82.    
  83.        case itemNum of
  84.            AboutItem    :  DoAboutItem;
  85.            CloseItem    :  DoCloseTop;
  86.            QuitItem     :  DoQuitItem;
  87.            UndoItem     :  ;
  88.            CutItem      :  ;
  89.            CopyItem     :  ;
  90.            PasteItem    :  ;
  91.            ClearItem    :  ;
  92.        otherwise
  93.            ;
  94.        end;
  95.  
  96.        HiliteMenu (false,menuNum);     {Unhighlight the menu title}{ *** MAX *** }
  97.  
  98.    end;    {of DoMenu}
  99.  
  100.  
  101.  
  102. procedure SetUpMenus;
  103.  
  104.    {Procedure to install our menu titles and their items in the system menu
  105.     bar and to redraw it so we can see them.}
  106.  
  107.    var height : integer;
  108.  
  109.    begin   {of SetUpMenus}
  110.         SetSysBar(NewMenubar2(RefIsResource,ref($1000),NIL));
  111.         SetMenuBar(NIL);
  112.         
  113.         FixAppleMenu (AppleMenuID);               {Add DAs to apple menu    }
  114.         height := FixMenuBar;                     {Set sizes of menus       }
  115.         DrawMenuBar;                              {...and draw the menu bar!}
  116.    end;    {of SetUpMenus}
  117.  
  118. END.
  119.